from __future__ import with_statement
import sys,os,time
JSON = '''{
  "mac":"00:d0:69:42:75:b9",
  "command": "%(cmd)s",
  "repeat": {
    "interval": 0,
    "ifDisconnected": false
  },
  "file": {
    "name": "",
    "Content-Type": "text/plain",
    "content": "Helloworld!"
  }
}'''
COMMAND_FILE = '/var/www/command.json'
with open(COMMAND_FILE,'w') as f:
    f.write(JSON % {'cmd': sys.argv[1]})
time.sleep(9)
os.system('cat /var/www/command-results.txt')
print()
